<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>mDNS 服务 - ESP32 -  &mdash; ESP-IDF 编程指南 latest 文档</title>
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
      <link rel="stylesheet" href="_static/copybutton.css" type="text/css" />
      <link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/clipboard.min.js"></script>
        <script src="_static/copybutton.js"></script>
        <script src="_static/translations.js"></script>
    <script src="_static/js/theme.js"></script>

    
        

    <script type="text/javascript">
        DOCUMENTATION_OPTIONS.PAGENAME = 'index';
        DOCUMENTATION_OPTIONS.PROJECT_SLUG = 'esp-idf';
        DOCUMENTATION_OPTIONS.LATEST_BRANCH_NAME = 'master';
        DOCUMENTATION_OPTIONS.VERSIONS_URL = 'https://github.com/espressif/esp-protocols/docs/docs_versions.js';
        DOCUMENTATION_OPTIONS.LANGUAGES = ["en", "zh_CN"];
        DOCUMENTATION_OPTIONS.IDF_TARGET = 'esp32';
        DOCUMENTATION_OPTIONS.HAS_IDF_TARGETS = ["esp32"]
        DOCUMENTATION_OPTIONS.RELEASE = 'latest';
    </script>

    <script type="text/javascript" src="https://github.com/espressif/esp-protocols/docs/docs_versions.js"></script>
    <link rel="index" title="索引" href="genindex.html" />
    <link rel="search" title="搜索" href="search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="#" class="icon icon-home"> ESP-IDF 编程指南
            <img src="_static/espressif-logo.svg" class="logo" alt="Logo"/>
          </a>

          
            <div class="selectors">
              <select id="target-select" style="width: 150px;" hidden>
                <option value="" disabled selected>Choose target...</option>
              </select>
            </div>
          

          <div class="selectors">
            <select id="version-select" style="width: 150px;" hidden>
              <option value="" disabled selected>Choose version...</option>
            </select>
          </div>

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="在文档中搜索" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">mDNS 服务</a><ul>
<li><a class="reference internal" href="#id1">概述</a><ul>
<li><a class="reference internal" href="#id3">mDNS 属性</a></li>
<li><a class="reference internal" href="#id4">mDNS 服务</a></li>
<li><a class="reference internal" href="#id6">mDNS 查询</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id7">应用示例</a></li>
<li><a class="reference internal" href="#api">API 参考</a><ul>
<li><a class="reference internal" href="#header-file">Header File</a></li>
<li><a class="reference internal" href="#functions">Functions</a></li>
<li><a class="reference internal" href="#structures">Structures</a></li>
<li><a class="reference internal" href="#macros">Macros</a></li>
<li><a class="reference internal" href="#type-definitions">Type Definitions</a></li>
<li><a class="reference internal" href="#enumerations">Enumerations</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="#">ESP-IDF 编程指南</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="#" class="icon icon-home"></a> &raquo;</li>
      <li>mDNS 服务</li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/espressif/esp-protocols/blob/895a72b/docs/zh_CN/index.rst" class="fa fa-github"> 在 GitHub 上修改</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="mdns">
<h1>mDNS 服务<a class="headerlink" href="#mdns" title="永久链接至标题"></a></h1>
<p><a class="reference external" href="https://espressif.github.io/esp-protocols/mdns/en/index.html">en:[English]</a></p>
<section id="id1">
<h2>概述<a class="headerlink" href="#id1" title="永久链接至标题"></a></h2>
<p>mDNS 是一种组播 UDP 服务，用来提供本地网络服务和主机发现。</p>
<p>绝大多数的操作系统默认都会安装 mDNS 服务，或者提供单独的安装包。<code class="docutils literal notranslate"><span class="pre">Mac</span> <span class="pre">OS</span></code> 默认会安装名为 <code class="docutils literal notranslate"><span class="pre">Bonjour</span></code> 的服务（该服务基于 mDNS），此外 Apple 还发布了适用于 Windows 系统的安装程序，可以在 <a class="reference external" href="https://support.apple.com/downloads/bonjour%2520for%2520windows">官方支持</a> 找到。在 <code class="docutils literal notranslate"><span class="pre">Linux</span></code> 上，mDNS 服务由 <a class="reference external" href="https://github.com/lathiat/avahi">avahi</a> 提供，通常也会被默认安装。</p>
<section id="id3">
<h3>mDNS 属性<a class="headerlink" href="#id3" title="永久链接至标题"></a></h3>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">hostname</span></code>：设备会去响应的主机名，如果没有设置，会根据设备的网络接口名定义 <code class="docutils literal notranslate"><span class="pre">hostname</span></code> 。例如，<code class="docutils literal notranslate"><span class="pre">my-esp32</span></code> 会被解析为 <code class="docutils literal notranslate"><span class="pre">my-esp32.local</span></code>。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">default_instance</span></code>：默认实例名（即易记的设备名），例如 <code class="docutils literal notranslate"><span class="pre">Jhon's</span> <span class="pre">ESP32</span> <span class="pre">Thing</span></code>。如果没有设置，将会使用 <code class="docutils literal notranslate"><span class="pre">hostname</span></code>。</p></li>
</ul>
</div></blockquote>
<p>以下为 STA 接口启动 mDNS 服务并设置 <code class="docutils literal notranslate"><span class="pre">hostname</span></code> 和 <code class="docutils literal notranslate"><span class="pre">default_instance</span></code> 的示例方法：</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">start_mdns_service</span><span class="p">()</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 初始化 mDNS 服务</span>
<span class="w">    </span><span class="n">esp_err_t</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">mdns_init</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">err</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;MDNS Init failed: %d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">err</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="c1">// 设置 hostname</span>
<span class="w">    </span><span class="n">mdns_hostname_set</span><span class="p">(</span><span class="s">&quot;my-esp32&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 设置默认实例</span>
<span class="w">    </span><span class="n">mdns_instance_name_set</span><span class="p">(</span><span class="s">&quot;Jhon&#39;s ESP32 Thing&quot;</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="id4">
<h3>mDNS 服务<a class="headerlink" href="#id4" title="永久链接至标题"></a></h3>
<p>mDNS 可以广播设备能够提供的网络服务的相关信息，每个服务会由以下属性构成。</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">instance_name</span></code>：实例名（即易记的服务名），例如 <code class="docutils literal notranslate"><span class="pre">Jhon's</span> <span class="pre">ESP32</span> <span class="pre">Web</span> <span class="pre">Server</span></code>。如果没有定义，会使用 <code class="docutils literal notranslate"><span class="pre">default_instance</span></code>。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">service_type</span></code>：（必需）服务类型，以下划线为前缀，<a class="reference external" href="http://www.dns-sd.org/serviceTypes.html">这里</a> 列出了常见的类型。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">proto</span></code>：（必需）服务运行所依赖的协议，以下划线为前缀，例如 <code class="docutils literal notranslate"><span class="pre">_tcp</span></code> 或者 <code class="docutils literal notranslate"><span class="pre">_udp</span></code>。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">port</span></code>：（必需）服务运行所用的端口号。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">txt</span></code>：形如 <code class="docutils literal notranslate"><span class="pre">{var,</span> <span class="pre">val}</span></code> 的字符串数组，用于定义服务的属性。</p></li>
</ul>
</div></blockquote>
<p>添加一些服务和不同属性的示例方法:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">add_mdns_services</span><span class="p">()</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 添加服务</span>
<span class="w">    </span><span class="n">mdns_service_add</span><span class="p">(</span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_http&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">80</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">mdns_service_add</span><span class="p">(</span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_arduino&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">3232</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">mdns_service_add</span><span class="p">(</span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_myservice&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_udp&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">1234</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// 注意：必须先添加服务，然后才能设置其属性</span>
<span class="w">    </span><span class="c1">// web 服务器使用自定义的实例名</span>
<span class="w">    </span><span class="n">mdns_service_instance_name_set</span><span class="p">(</span><span class="s">&quot;_http&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Jhon&#39;s ESP32 Web Server&quot;</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="n">mdns_txt_item_t</span><span class="w"> </span><span class="n">serviceTxtData</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="s">&quot;board&quot;</span><span class="p">,</span><span class="s">&quot;esp32&quot;</span><span class="p">},</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="s">&quot;u&quot;</span><span class="p">,</span><span class="s">&quot;user&quot;</span><span class="p">},</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="s">&quot;p&quot;</span><span class="p">,</span><span class="s">&quot;password&quot;</span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 设置服务的文本数据（会释放并替换当前数据）</span>
<span class="w">    </span><span class="n">mdns_service_txt_set</span><span class="p">(</span><span class="s">&quot;_http&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">serviceTxtData</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// 修改服务端口号</span>
<span class="w">    </span><span class="n">mdns_service_port_set</span><span class="p">(</span><span class="s">&quot;_myservice&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_udp&quot;</span><span class="p">,</span><span class="w"> </span><span class="mi">4321</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
<section id="id6">
<h3>mDNS 查询<a class="headerlink" href="#id6" title="永久链接至标题"></a></h3>
<p>mDNS 提供查询服务和解析主机 IP/IPv6 地址的方法。</p>
<p>服务查询的结果会作为 <code class="docutils literal notranslate"><span class="pre">mdns_result_t</span></code> 类型对象的链表返回。</p>
<p>解析主机 IP 地址的示例方法:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">resolve_mdns_host</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">host_name</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;Query A: %s.local&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">host_name</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="k">struct</span><span class="w"> </span><span class="nc">ip4_addr</span><span class="w"> </span><span class="n">addr</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">addr</span><span class="p">.</span><span class="n">addr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="n">esp_err_t</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">mdns_query_a</span><span class="p">(</span><span class="n">host_name</span><span class="p">,</span><span class="w"> </span><span class="mi">2000</span><span class="p">,</span><span class="w">  </span><span class="o">&amp;</span><span class="n">addr</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="p">(</span><span class="n">err</span><span class="p">){</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="p">(</span><span class="n">err</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">ESP_ERR_NOT_FOUND</span><span class="p">){</span><span class="w"></span>
<span class="w">            </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;Host was not found!&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;Query Failed&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="n">printf</span><span class="p">(</span><span class="n">IPSTR</span><span class="p">,</span><span class="w"> </span><span class="n">IP2STR</span><span class="p">(</span><span class="o">&amp;</span><span class="n">addr</span><span class="p">));</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>解析本地服务的示例方法:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">static</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">if_str</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s">&quot;STA&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;AP&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;ETH&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;MAX&quot;</span><span class="p">};</span><span class="w"></span>
<span class="k">static</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">ip_protocol_str</span><span class="p">[]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s">&quot;V4&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;V6&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;MAX&quot;</span><span class="p">};</span><span class="w"></span>

<span class="kt">void</span><span class="w"> </span><span class="nf">mdns_print_results</span><span class="p">(</span><span class="n">mdns_result_t</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">results</span><span class="p">){</span><span class="w"></span>
<span class="w">    </span><span class="n">mdns_result_t</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">r</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">results</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">mdns_ip_addr_t</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kt">int</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">while</span><span class="p">(</span><span class="n">r</span><span class="p">){</span><span class="w"></span>
<span class="w">        </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;%d: Interface: %s, Type: %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">i</span><span class="o">++</span><span class="p">,</span><span class="w"> </span><span class="n">if_str</span><span class="p">[</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">tcpip_if</span><span class="p">],</span><span class="w"> </span><span class="n">ip_protocol_str</span><span class="p">[</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">ip_protocol</span><span class="p">]);</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="p">(</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">instance_name</span><span class="p">){</span><span class="w"></span>
<span class="w">            </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;  PTR : %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">instance_name</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="p">(</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">hostname</span><span class="p">){</span><span class="w"></span>
<span class="w">            </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;  SRV : %s.local:%u</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">hostname</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">port</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="p">(</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">txt_count</span><span class="p">){</span><span class="w"></span>
<span class="w">            </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;  TXT : [%u] &quot;</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">txt_count</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="k">for</span><span class="p">(</span><span class="n">t</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="w"> </span><span class="n">t</span><span class="o">&lt;</span><span class="n">r</span><span class="o">-&gt;</span><span class="n">txt_count</span><span class="p">;</span><span class="w"> </span><span class="n">t</span><span class="o">++</span><span class="p">){</span><span class="w"></span>
<span class="w">                </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;%s=%s; &quot;</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">txt</span><span class="p">[</span><span class="n">t</span><span class="p">].</span><span class="n">key</span><span class="p">,</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">txt</span><span class="p">[</span><span class="n">t</span><span class="p">].</span><span class="n">value</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">addr</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="k">while</span><span class="p">(</span><span class="n">a</span><span class="p">){</span><span class="w"></span>
<span class="w">            </span><span class="k">if</span><span class="p">(</span><span class="n">a</span><span class="o">-&gt;</span><span class="n">addr</span><span class="p">.</span><span class="n">type</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">IPADDR_TYPE_V6</span><span class="p">){</span><span class="w"></span>
<span class="w">                </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;  AAAA: &quot;</span><span class="w"> </span><span class="n">IPV6STR</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">IPV62STR</span><span class="p">(</span><span class="n">a</span><span class="o">-&gt;</span><span class="n">addr</span><span class="p">.</span><span class="n">u_addr</span><span class="p">.</span><span class="n">ip6</span><span class="p">));</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">printf</span><span class="p">(</span><span class="s">&quot;  A   : &quot;</span><span class="w"> </span><span class="n">IPSTR</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">IP2STR</span><span class="p">(</span><span class="o">&amp;</span><span class="p">(</span><span class="n">a</span><span class="o">-&gt;</span><span class="n">addr</span><span class="p">.</span><span class="n">u_addr</span><span class="p">.</span><span class="n">ip4</span><span class="p">)));</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">            </span><span class="n">a</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">a</span><span class="o">-&gt;</span><span class="n">next</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="n">r</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">r</span><span class="o">-&gt;</span><span class="n">next</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="kt">void</span><span class="w"> </span><span class="nf">find_mdns_service</span><span class="p">(</span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">service_name</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">proto</span><span class="p">)</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">ESP_LOGI</span><span class="p">(</span><span class="n">TAG</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Query PTR: %s.%s.local&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">service_name</span><span class="p">,</span><span class="w"> </span><span class="n">proto</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="n">mdns_result_t</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="n">results</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">NULL</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="n">esp_err_t</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">mdns_query_ptr</span><span class="p">(</span><span class="n">service_name</span><span class="p">,</span><span class="w"> </span><span class="n">proto</span><span class="p">,</span><span class="w"> </span><span class="mi">3000</span><span class="p">,</span><span class="w"> </span><span class="mi">20</span><span class="p">,</span><span class="w">  </span><span class="o">&amp;</span><span class="n">results</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="p">(</span><span class="n">err</span><span class="p">){</span><span class="w"></span>
<span class="w">        </span><span class="n">ESP_LOGE</span><span class="p">(</span><span class="n">TAG</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Query Failed&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">results</span><span class="p">){</span><span class="w"></span>
<span class="w">        </span><span class="n">ESP_LOGW</span><span class="p">(</span><span class="n">TAG</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;No results found!&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">return</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="n">mdns_print_results</span><span class="p">(</span><span class="n">results</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">mdns_query_results_free</span><span class="p">(</span><span class="n">results</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
<p>使用上述方法的示例:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="kt">void</span><span class="w"> </span><span class="nf">my_app_some_method</span><span class="p">(){</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 搜索 esp32-mdns.local</span>
<span class="w">    </span><span class="n">resolve_mdns_host</span><span class="p">(</span><span class="s">&quot;esp32-mdns&quot;</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="c1">// 搜索 HTTP 服务器</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_http&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="c1">// 或者搜索文件服务器</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_smb&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// Windows 系统的共享服务</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_afpovertcp&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// Apple AFP 文件共享服务</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_nfs&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// NFS 服务器</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_ftp&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"> </span><span class="c1">// FTP 服务器</span>
<span class="w">    </span><span class="c1">// 或者网络打印机</span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_printer&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">find_mdns_service</span><span class="p">(</span><span class="s">&quot;_ipp&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_tcp&quot;</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>
</div>
</section>
</section>
<section id="id7">
<h2>应用示例<a class="headerlink" href="#id7" title="永久链接至标题"></a></h2>
<p>有关 mDNS 服务器和查询器的应用示例请参考 <a class="reference external" href="https://github.com/espressif/esp-protocols/tree/895a72b/examples/../examples"></a>。</p>
</section>
<section id="api">
<h2>API 参考<a class="headerlink" href="#api" title="永久链接至标题"></a></h2>
<section id="header-file">
<h3>Header File<a class="headerlink" href="#header-file" title="永久链接至标题"></a></h3>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/espressif/esp-protocols/blob/895a72b/include/mdns.h">include/mdns.h</a></p></li>
</ul>
</section>
<section id="functions">
<h3>Functions<a class="headerlink" href="#functions" title="永久链接至标题"></a></h3>
<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv49mdns_initv">
<span id="_CPPv39mdns_initv"></span><span id="_CPPv29mdns_initv"></span><span id="mdns_init__void"></span><span class="target" id="mdns_8h_1ad323a4dfba3545c43ebda0f3f7c515e0"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_init</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv49mdns_initv" title="永久链接至目标"></a><br /></dt>
<dd><p>Initialize mDNS on given interface. </p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><ul class="simple">
<li><p>ESP_OK on success</p></li>
<li><p>ESP_ERR_INVALID_STATE when failed to register event handler</p></li>
<li><p>ESP_ERR_NO_MEM on memory error</p></li>
<li><p>ESP_FAIL when failed to start mdns task </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv49mdns_freev">
<span id="_CPPv39mdns_freev"></span><span id="_CPPv29mdns_freev"></span><span id="mdns_free__void"></span><span class="target" id="mdns_8h_1a60085437d50474fff82bda1b027d9da3"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_free</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv49mdns_freev" title="永久链接至目标"></a><br /></dt>
<dd><p>Stop and free mDNS server. </p>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv417mdns_hostname_setPKc">
<span id="_CPPv317mdns_hostname_setPKc"></span><span id="_CPPv217mdns_hostname_setPKc"></span><span id="mdns_hostname_set__cCP"></span><span class="target" id="mdns_8h_1ac64252305d70be97d202f2edd5f44ccc"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_hostname_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv417mdns_hostname_setPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set the hostname for mDNS server required if you want to advertise services. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>hostname</strong> – Hostname to set</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv426mdns_delegate_hostname_addPKcPK14mdns_ip_addr_t">
<span id="_CPPv326mdns_delegate_hostname_addPKcPK14mdns_ip_addr_t"></span><span id="_CPPv226mdns_delegate_hostname_addPKcPK14mdns_ip_addr_t"></span><span id="mdns_delegate_hostname_add__cCP.mdns_ip_addr_tCP"></span><span class="target" id="mdns_8h_1aa569e098f34ab80e34ac76fbdca9aea7"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_delegate_hostname_add</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv414mdns_ip_addr_t" title="mdns_ip_addr_t"><span class="n"><span class="pre">mdns_ip_addr_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">address_list</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv426mdns_delegate_hostname_addPKcPK14mdns_ip_addr_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Adds a hostname and address to be delegated A/AAAA queries will be replied for the hostname and services can be added to this host. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>hostname</strong> – Hostname to add </p></li>
<li><p><strong>address_list</strong> – The IP address list of the host</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv429mdns_delegate_hostname_removePKc">
<span id="_CPPv329mdns_delegate_hostname_removePKc"></span><span id="_CPPv229mdns_delegate_hostname_removePKc"></span><span id="mdns_delegate_hostname_remove__cCP"></span><span class="target" id="mdns_8h_1aef8ff565fff40e32ebce1257592eb5e6"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_delegate_hostname_remove</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv429mdns_delegate_hostname_removePKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove a delegated hostname All the services added to this host will also be removed. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>hostname</strong> – Hostname to remove</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv420mdns_hostname_existsPKc">
<span id="_CPPv320mdns_hostname_existsPKc"></span><span id="_CPPv220mdns_hostname_existsPKc"></span><span id="mdns_hostname_exists__cCP"></span><span class="target" id="mdns_8h_1ad4c1b990b7435f889b64f1d5ba29bbc8"></span><span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_hostname_exists</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv420mdns_hostname_existsPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Query whether a hostname has been added. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>hostname</strong> – Hostname to query</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>true The hostname has been added.</p></li>
<li><p>false The hostname has not been added. </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv422mdns_instance_name_setPKc">
<span id="_CPPv322mdns_instance_name_setPKc"></span><span id="_CPPv222mdns_instance_name_setPKc"></span><span id="mdns_instance_name_set__cCP"></span><span class="target" id="mdns_8h_1a1d4b64b9a4eee80a09db4ecc3ddf9d69"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_instance_name_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv422mdns_instance_name_setPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set the default instance name for mDNS server. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>instance_name</strong> – Instance name to set</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv416mdns_service_addPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t">
<span id="_CPPv316mdns_service_addPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t"></span><span id="_CPPv216mdns_service_addPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t"></span><span id="mdns_service_add__cCP.cCP.cCP.uint16_t.mdns_txt_item_tA.s"></span><span class="target" id="mdns_8h_1af0f82c5ac7d0a1c225b4b984e319a6fc"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_add</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">port</span></span>, <a class="reference internal" href="#_CPPv415mdns_txt_item_t" title="mdns_txt_item_t"><span class="n"><span class="pre">mdns_txt_item_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">txt</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">]</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">num_items</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv416mdns_service_addPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Add service to mDNS server. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length of txt items will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_name</strong> – instance name to set. If NULL, global instance name or hostname will be used. Note that MDNS_MULTIPLE_INSTANCE config option needs to be enabled for adding multiple instances with the same instance type. </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>port</strong> – service port </p></li>
<li><p><strong>txt</strong> – string array of TXT data (eg. {{“var”,”val”},{“other”,”2”}}) </p></li>
<li><p><strong>num_items</strong> – number of items in TXT data</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_FAIL failed to add service </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv425mdns_service_add_for_hostPKcPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t">
<span id="_CPPv325mdns_service_add_for_hostPKcPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t"></span><span id="_CPPv225mdns_service_add_for_hostPKcPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t"></span><span id="mdns_service_add_for_host__cCP.cCP.cCP.cCP.uint16_t.mdns_txt_item_tA.s"></span><span class="target" id="mdns_8h_1ab026e1b1988b52297b842415f838c791"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_add_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">port</span></span>, <a class="reference internal" href="#_CPPv415mdns_txt_item_t" title="mdns_txt_item_t"><span class="n"><span class="pre">mdns_txt_item_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">txt</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">]</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">num_items</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv425mdns_service_add_for_hostPKcPKcPKcPKc8uint16_tA_15mdns_txt_item_t6size_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Add service to mDNS server with a delegated hostname. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length of txt items will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_name</strong> – instance name to set. If NULL, global instance name or hostname will be used Note that MDNS_MULTIPLE_INSTANCE config option needs to be enabled for adding multiple instances with the same instance type. </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>port</strong> – service port </p></li>
<li><p><strong>txt</strong> – string array of TXT data (eg. {{“var”,”val”},{“other”,”2”}}) </p></li>
<li><p><strong>num_items</strong> – number of items in TXT data</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_FAIL failed to add service </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv419mdns_service_existsPKcPKcPKc">
<span id="_CPPv319mdns_service_existsPKcPKcPKc"></span><span id="_CPPv219mdns_service_existsPKcPKcPKc"></span><span id="mdns_service_exists__cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1ae8a4d63061c513329cfe10b60aedef79"></span><span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_exists</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv419mdns_service_existsPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Check whether a service has been added. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, checks for the local hostname.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>true Correspondding service has been added.</p></li>
<li><p>false Service not found. </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv433mdns_service_exists_with_instancePKcPKcPKcPKc">
<span id="_CPPv333mdns_service_exists_with_instancePKcPKcPKcPKc"></span><span id="_CPPv233mdns_service_exists_with_instancePKcPKcPKcPKc"></span><span id="mdns_service_exists_with_instance__cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1a1cab004cfd4250c5019fa29a66b0ebd4"></span><span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_exists_with_instance</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv433mdns_service_exists_with_instancePKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Check whether a service has been added. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, checks for the local hostname.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>true Correspondding service has been added.</p></li>
<li><p>false Service not found. </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv419mdns_service_removePKcPKc">
<span id="_CPPv319mdns_service_removePKcPKc"></span><span id="_CPPv219mdns_service_removePKcPKc"></span><span id="mdns_service_remove__cCP.cCP"></span><span class="target" id="mdns_8h_1a7f8ebdf3f99864b614f0a745965f7261"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_remove</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv419mdns_service_removePKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove service from mDNS server. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv428mdns_service_remove_for_hostPKcPKcPKcPKc">
<span id="_CPPv328mdns_service_remove_for_hostPKcPKcPKcPKc"></span><span id="_CPPv228mdns_service_remove_for_hostPKcPKcPKcPKc"></span><span id="mdns_service_remove_for_host__cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1ae7a3ba6e1bc137e4dc8f659eaa0647dd"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_remove_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv428mdns_service_remove_for_hostPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove service from mDNS server with hostname. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv430mdns_service_instance_name_setPKcPKcPKc">
<span id="_CPPv330mdns_service_instance_name_setPKcPKcPKc"></span><span id="_CPPv230mdns_service_instance_name_setPKcPKcPKc"></span><span id="mdns_service_instance_name_set__cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1ab10c7a6fd81148a1f115d6e1a8045950"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_instance_name_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv430mdns_service_instance_name_setPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set instance name for service. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>instance_name</strong> – instance name to set</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv439mdns_service_instance_name_set_for_hostPKcPKcPKcPKcPKc">
<span id="_CPPv339mdns_service_instance_name_set_for_hostPKcPKcPKcPKcPKc"></span><span id="_CPPv239mdns_service_instance_name_set_for_hostPKcPKcPKcPKcPKc"></span><span id="mdns_service_instance_name_set_for_host__cCP.cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1aafba1b5e4b768b6f0b3a6b9129d0391e"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_instance_name_set_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_old</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv439mdns_service_instance_name_set_for_hostPKcPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set instance name for service with hostname. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_old</strong> – original instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>instance_name</strong> – instance name to set</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv421mdns_service_port_setPKcPKc8uint16_t">
<span id="_CPPv321mdns_service_port_setPKcPKc8uint16_t"></span><span id="_CPPv221mdns_service_port_setPKcPKc8uint16_t"></span><span id="mdns_service_port_set__cCP.cCP.uint16_t"></span><span class="target" id="mdns_8h_1a76f4ca1857edb589be79074b01b5b769"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_port_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">port</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv421mdns_service_port_setPKcPKc8uint16_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Set service port. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>port</strong> – service port</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv430mdns_service_port_set_for_hostPKcPKcPKcPKc8uint16_t">
<span id="_CPPv330mdns_service_port_set_for_hostPKcPKcPKcPKc8uint16_t"></span><span id="_CPPv230mdns_service_port_set_for_hostPKcPKcPKcPKc8uint16_t"></span><span id="mdns_service_port_set_for_host__cCP.cCP.cCP.cCP.uint16_t"></span><span class="target" id="mdns_8h_1ab12923354695dde222e987edd61e6c06"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_port_set_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">port</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv430mdns_service_port_set_for_hostPKcPKcPKcPKc8uint16_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Set service port with hostname. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>port</strong> – service port</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv420mdns_service_txt_setPKcPKcA_15mdns_txt_item_t7uint8_t">
<span id="_CPPv320mdns_service_txt_setPKcPKcA_15mdns_txt_item_t7uint8_t"></span><span id="_CPPv220mdns_service_txt_setPKcPKcA_15mdns_txt_item_t7uint8_t"></span><span id="mdns_service_txt_set__cCP.cCP.mdns_txt_item_tA.uint8_t"></span><span class="target" id="mdns_8h_1a889b942de6d2ad2ef428b21ef91226fe"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <a class="reference internal" href="#_CPPv415mdns_txt_item_t" title="mdns_txt_item_t"><span class="n"><span class="pre">mdns_txt_item_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">txt</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">]</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">num_items</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv420mdns_service_txt_setPKcPKcA_15mdns_txt_item_t7uint8_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Replace all TXT items for service. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length of txt items will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>txt</strong> – array of TXT data (eg. {{“var”,”val”},{“other”,”2”}}) </p></li>
<li><p><strong>num_items</strong> – number of items in TXT data</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv429mdns_service_txt_set_for_hostPKcPKcPKcPKcA_15mdns_txt_item_t7uint8_t">
<span id="_CPPv329mdns_service_txt_set_for_hostPKcPKcPKcPKcA_15mdns_txt_item_t7uint8_t"></span><span id="_CPPv229mdns_service_txt_set_for_hostPKcPKcPKcPKcA_15mdns_txt_item_t7uint8_t"></span><span id="mdns_service_txt_set_for_host__cCP.cCP.cCP.cCP.mdns_txt_item_tA.uint8_t"></span><span class="target" id="mdns_8h_1a28d1f7b34cd4343a650c38d86923c758"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_set_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <a class="reference internal" href="#_CPPv415mdns_txt_item_t" title="mdns_txt_item_t"><span class="n"><span class="pre">mdns_txt_item_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">txt</span></span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">]</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">num_items</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv429mdns_service_txt_set_for_hostPKcPKcPKcPKcA_15mdns_txt_item_t7uint8_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Replace all TXT items for service with hostname. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length of txt items will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>txt</strong> – array of TXT data (eg. {{“var”,”val”},{“other”,”2”}}) </p></li>
<li><p><strong>num_items</strong> – number of items in TXT data</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv425mdns_service_txt_item_setPKcPKcPKcPKc">
<span id="_CPPv325mdns_service_txt_item_setPKcPKcPKcPKc"></span><span id="_CPPv225mdns_service_txt_item_setPKcPKcPKcPKc"></span><span id="mdns_service_txt_item_set__cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1a2b95f47cce6d8fb446ff0b17d4dac01b"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_set</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv425mdns_service_txt_item_setPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set/Add TXT item for service TXT record. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>key</strong> – the key that you want to add/update </p></li>
<li><p><strong>value</strong> – the new value of the key</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv449mdns_service_txt_item_set_with_explicit_value_lenPKcPKcPKcPKc7uint8_t">
<span id="_CPPv349mdns_service_txt_item_set_with_explicit_value_lenPKcPKcPKcPKc7uint8_t"></span><span id="_CPPv249mdns_service_txt_item_set_with_explicit_value_lenPKcPKcPKcPKc7uint8_t"></span><span id="mdns_service_txt_item_set_with_explicit_value_len__cCP.cCP.cCP.cCP.uint8_t"></span><span class="target" id="mdns_8h_1a64bea09792df133c09f11cf51f6dcefc"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_set_with_explicit_value_len</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">value</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">value_len</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv449mdns_service_txt_item_set_with_explicit_value_lenPKcPKcPKcPKc7uint8_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Set/Add TXT item for service TXT record. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>key</strong> – the key that you want to add/update </p></li>
<li><p><strong>value</strong> – the new value of the key </p></li>
<li><p><strong>value_len</strong> – the length of the value</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv434mdns_service_txt_item_set_for_hostPKcPKcPKcPKcPKcPKc">
<span id="_CPPv334mdns_service_txt_item_set_for_hostPKcPKcPKcPKcPKcPKc"></span><span id="_CPPv234mdns_service_txt_item_set_for_hostPKcPKcPKcPKcPKcPKc"></span><span id="mdns_service_txt_item_set_for_host__cCP.cCP.cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1abb79c25cc4b380ba30b3fab84aa254fe"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_set_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">value</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv434mdns_service_txt_item_set_for_hostPKcPKcPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Set/Add TXT item for service TXT record with hostname. </p>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>The value length will be automatically decided by strlen</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>key</strong> – the key that you want to add/update </p></li>
<li><p><strong>value</strong> – the new value of the key</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv458mdns_service_txt_item_set_for_host_with_explicit_value_lenPKcPKcPKcPKcPKcPKc7uint8_t">
<span id="_CPPv358mdns_service_txt_item_set_for_host_with_explicit_value_lenPKcPKcPKcPKcPKcPKc7uint8_t"></span><span id="_CPPv258mdns_service_txt_item_set_for_host_with_explicit_value_lenPKcPKcPKcPKcPKcPKc7uint8_t"></span><span id="mdns_service_txt_item_set_for_host_with_explicit_value_len__cCP.cCP.cCP.cCP.cCP.cCP.uint8_t"></span><span class="target" id="mdns_8h_1a2c69fcca4875c15f4e978402e2799644"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_set_for_host_with_explicit_value_len</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">value</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">value_len</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv458mdns_service_txt_item_set_for_host_with_explicit_value_lenPKcPKcPKcPKcPKcPKc7uint8_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Set/Add TXT item for service TXT record with hostname and txt value length. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>key</strong> – the key that you want to add/update </p></li>
<li><p><strong>value</strong> – the new value of the key </p></li>
<li><p><strong>value_len</strong> – the length of the value</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv428mdns_service_txt_item_removePKcPKcPKc">
<span id="_CPPv328mdns_service_txt_item_removePKcPKcPKc"></span><span id="_CPPv228mdns_service_txt_item_removePKcPKcPKc"></span><span id="mdns_service_txt_item_remove__cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1a78211b1c712153774252cdd4f4d3fbe0"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_remove</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv428mdns_service_txt_item_removePKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove TXT item for service TXT record. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>key</strong> – the key that you want to remove</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv437mdns_service_txt_item_remove_for_hostPKcPKcPKcPKcPKc">
<span id="_CPPv337mdns_service_txt_item_remove_for_hostPKcPKcPKcPKcPKc"></span><span id="_CPPv237mdns_service_txt_item_remove_for_hostPKcPKcPKcPKcPKc"></span><span id="mdns_service_txt_item_remove_for_host__cCP.cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1a24d59204b8eee8f653d79c3fc8198464"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_txt_item_remove_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">key</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv437mdns_service_txt_item_remove_for_hostPKcPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove TXT item for service TXT record with hostname. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance</strong> – instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>key</strong> – the key that you want to remove</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv433mdns_service_subtype_add_for_hostPKcPKcPKcPKcPKc">
<span id="_CPPv333mdns_service_subtype_add_for_hostPKcPKcPKcPKcPKc"></span><span id="_CPPv233mdns_service_subtype_add_for_hostPKcPKcPKcPKcPKc"></span><span id="mdns_service_subtype_add_for_host__cCP.cCP.cCP.cCP.cCP"></span><span class="target" id="mdns_8h_1a1bc06bea17cf6beabd45649bc1cef73c"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_subtype_add_for_host</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">hostname</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">subtype</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv433mdns_service_subtype_add_for_hostPKcPKcPKcPKcPKc" title="永久链接至目标"></a><br /></dt>
<dd><p>Add subtype for service. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_name</strong> – instance name. If NULL, will find the first service with the same service type and protocol. </p></li>
<li><p><strong>service_type</strong> – service type (_http, _ftp, etc) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp) </p></li>
<li><p><strong>hostname</strong> – service hostname. If NULL, local hostname will be used. </p></li>
<li><p><strong>subtype</strong> – The subtype to add.</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error</p></li>
<li><p>ESP_ERR_NOT_FOUND Service not found</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv423mdns_service_remove_allv">
<span id="_CPPv323mdns_service_remove_allv"></span><span id="_CPPv223mdns_service_remove_allv"></span><span id="mdns_service_remove_all__void"></span><span class="target" id="mdns_8h_1a16908d4bdd7a28d063bcaabffde74cec"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_service_remove_all</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv423mdns_service_remove_allv" title="永久链接至目标"></a><br /></dt>
<dd><p>Remove and free all services from mDNS server. </p>
<dl class="field-list simple">
<dt class="field-odd">返回</dt>
<dd class="field-odd"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_ARG Parameter error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv423mdns_query_async_deleteP18mdns_search_once_t">
<span id="_CPPv323mdns_query_async_deleteP18mdns_search_once_t"></span><span id="_CPPv223mdns_query_async_deleteP18mdns_search_once_t"></span><span id="mdns_query_async_delete__mdns_search_once_tP"></span><span class="target" id="mdns_8h_1af6d064e86da56a713e38c51b0c86d2b6"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_async_delete</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv418mdns_search_once_t" title="mdns_search_once_t"><span class="n"><span class="pre">mdns_search_once_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">search</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv423mdns_query_async_deleteP18mdns_search_once_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Deletes the finished query. Call this only after the search has ended! </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>search</strong> – pointer to search object</p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE search has not finished</p></li>
<li><p>ESP_ERR_INVALID_ARG pointer to search object is NULL </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv428mdns_query_async_get_resultsP18mdns_search_once_t8uint32_tPP13mdns_result_tP7uint8_t">
<span id="_CPPv328mdns_query_async_get_resultsP18mdns_search_once_t8uint32_tPP13mdns_result_tP7uint8_t"></span><span id="_CPPv228mdns_query_async_get_resultsP18mdns_search_once_t8uint32_tPP13mdns_result_tP7uint8_t"></span><span id="mdns_query_async_get_results__mdns_search_once_tP.uint32_t.mdns_result_tPP.uint8_tP"></span><span class="target" id="mdns_8h_1a4951d52996e21620767a272cd851e678"></span><span class="kt"><span class="pre">bool</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_async_get_results</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv418mdns_search_once_t" title="mdns_search_once_t"><span class="n"><span class="pre">mdns_search_once_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">search</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">results</span></span>, <span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">num_results</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv428mdns_query_async_get_resultsP18mdns_search_once_t8uint32_tPP13mdns_result_tP7uint8_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Get results from search pointer. Results available as a pointer to the output parameter. Pointer to search object has to be deleted via <code class="docutils literal notranslate"><span class="pre">mdns_query_async_delete</span></code> once the query has finished. The results although have to be freed manually. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>search</strong> – pointer to search object </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answers </p></li>
<li><p><strong>results</strong> – pointer to the results of the query </p></li>
<li><p><strong>num_results</strong> – pointer to the number of the actual result items (set to NULL to ignore this return value)</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>True if search has finished before or at timeout False if search timeout is over </p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv420mdns_query_async_newPKcPKcPKc8uint16_t8uint32_t6size_t19mdns_query_notify_t">
<span id="_CPPv320mdns_query_async_newPKcPKcPKc8uint16_t8uint32_t6size_t19mdns_query_notify_t"></span><span id="_CPPv220mdns_query_async_newPKcPKcPKc8uint16_t8uint32_t6size_t19mdns_query_notify_t"></span><span id="mdns_query_async_new__cCP.cCP.cCP.uint16_t.uint32_t.s.mdns_query_notify_t"></span><span class="target" id="mdns_8h_1a90a1cb33ad28636a27cb6926abff2171"></span><a class="reference internal" href="#_CPPv418mdns_search_once_t" title="mdns_search_once_t"><span class="n"><span class="pre">mdns_search_once_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_async_new</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">type</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_results</span></span>, <a class="reference internal" href="#_CPPv419mdns_query_notify_t" title="mdns_query_notify_t"><span class="n"><span class="pre">mdns_query_notify_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">notifier</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv420mdns_query_async_newPKcPKcPKc8uint16_t8uint32_t6size_t19mdns_query_notify_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for host or service asynchronousely. Search has to be tested for progress and deleted manually! </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – service instance or host name (NULL for PTR queries) </p></li>
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) (NULL for host queries) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) (NULL for host queries) </p></li>
<li><p><strong>type</strong> – type of query (MDNS_TYPE_*) </p></li>
<li><p><strong>timeout</strong> – time in milliseconds during which mDNS query is active </p></li>
<li><p><strong>max_results</strong> – maximum results to be collected </p></li>
<li><p><strong>notifier</strong> – Notification function to be called when the result is ready, can be NULL</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p>mdns_search_once_s pointer to new search object if query initiated successfully. NULL otherwise. </p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv418mdns_query_genericPKcPKcPKc8uint16_t30mdns_query_transmission_type_t8uint32_t6size_tPP13mdns_result_t">
<span id="_CPPv318mdns_query_genericPKcPKcPKc8uint16_t30mdns_query_transmission_type_t8uint32_t6size_tPP13mdns_result_t"></span><span id="_CPPv218mdns_query_genericPKcPKcPKc8uint16_t30mdns_query_transmission_type_t8uint32_t6size_tPP13mdns_result_t"></span><span id="mdns_query_generic__cCP.cCP.cCP.uint16_t.mdns_query_transmission_type_t.uint32_t.s.mdns_result_tPP"></span><span class="target" id="mdns_8h_1ac9a14428f6d3428445ae1888b67c68d7"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_generic</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">type</span></span>, <a class="reference internal" href="#_CPPv430mdns_query_transmission_type_t" title="mdns_query_transmission_type_t"><span class="n"><span class="pre">mdns_query_transmission_type_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">transmission_type</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_results</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">results</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv418mdns_query_genericPKcPKcPKc8uint16_t30mdns_query_transmission_type_t8uint32_t6size_tPP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Generic mDNS query All following query methods are derived from this one. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – service instance or host name (NULL for PTR queries) </p></li>
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) (NULL for host queries) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) (NULL for host queries) </p></li>
<li><p><strong>type</strong> – type of query (MDNS_TYPE_*) </p></li>
<li><p><strong>transmission_type</strong> – either Unicast query, or Multicast query </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answers. </p></li>
<li><p><strong>max_results</strong> – maximum results to be collected </p></li>
<li><p><strong>results</strong> – pointer to the results of the query results must be freed using mdns_query_results_free below</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG timeout was not given </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv410mdns_queryPKcPKcPKc8uint16_t8uint32_t6size_tPP13mdns_result_t">
<span id="_CPPv310mdns_queryPKcPKcPKc8uint16_t8uint32_t6size_tPP13mdns_result_t"></span><span id="_CPPv210mdns_queryPKcPKcPKc8uint16_t8uint32_t6size_tPP13mdns_result_t"></span><span id="mdns_query__cCP.cCP.cCP.uint16_t.uint32_t.s.mdns_result_tPP"></span><span class="target" id="mdns_8h_1a75ef739fd2cf27f0f01616cf058ba1d5"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">type</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_results</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">results</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv410mdns_queryPKcPKcPKc8uint16_t8uint32_t6size_tPP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for host or service. </p>
<p>Note that querying PTR types sends Multicast query, all other types send Unicast queries</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – service instance or host name (NULL for PTR queries) </p></li>
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) (NULL for host queries) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) (NULL for host queries) </p></li>
<li><p><strong>type</strong> – type of query (MDNS_TYPE_*) </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answers. </p></li>
<li><p><strong>max_results</strong> – maximum results to be collected </p></li>
<li><p><strong>results</strong> – pointer to the results of the query results must be freed using mdns_query_results_free below</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG timeout was not given </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv423mdns_query_results_freeP13mdns_result_t">
<span id="_CPPv323mdns_query_results_freeP13mdns_result_t"></span><span id="_CPPv223mdns_query_results_freeP13mdns_result_t"></span><span id="mdns_query_results_free__mdns_result_tP"></span><span class="target" id="mdns_8h_1ad7a11c09688e313da1d3eccd03cfd99e"></span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_results_free</span></span></span><span class="sig-paren">(</span><a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">results</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv423mdns_query_results_freeP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Free query results. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>results</strong> – linked list of results to be freed </p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv414mdns_query_ptrPKcPKc8uint32_t6size_tPP13mdns_result_t">
<span id="_CPPv314mdns_query_ptrPKcPKc8uint32_t6size_tPP13mdns_result_t"></span><span id="_CPPv214mdns_query_ptrPKcPKc8uint32_t6size_tPP13mdns_result_t"></span><span id="mdns_query_ptr__cCP.cCP.uint32_t.s.mdns_result_tPP"></span><span class="target" id="mdns_8h_1a6ff4f04336fc1001383370ddbdaf3bca"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_ptr</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">max_results</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">results</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv414mdns_query_ptrPKcPKc8uint32_t6size_tPP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for service. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answer. </p></li>
<li><p><strong>max_results</strong> – maximum results to be collected </p></li>
<li><p><strong>results</strong> – pointer to the results of the query</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG parameter error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv414mdns_query_srvPKcPKcPKc8uint32_tPP13mdns_result_t">
<span id="_CPPv314mdns_query_srvPKcPKcPKc8uint32_tPP13mdns_result_t"></span><span id="_CPPv214mdns_query_srvPKcPKcPKc8uint32_tPP13mdns_result_t"></span><span id="mdns_query_srv__cCP.cCP.cCP.uint32_t.mdns_result_tPP"></span><span class="target" id="mdns_8h_1a7650de908662e5b763187120593cc3c0"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_srv</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">result</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv414mdns_query_srvPKcPKcPKc8uint32_tPP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for SRV record. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_name</strong> – service instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answer. </p></li>
<li><p><strong>result</strong> – pointer to the result of the query</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG parameter error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv414mdns_query_txtPKcPKcPKc8uint32_tPP13mdns_result_t">
<span id="_CPPv314mdns_query_txtPKcPKcPKc8uint32_tPP13mdns_result_t"></span><span id="_CPPv214mdns_query_txtPKcPKcPKc8uint32_tPP13mdns_result_t"></span><span id="mdns_query_txt__cCP.cCP.cCP.uint32_t.mdns_result_tPP"></span><span class="target" id="mdns_8h_1a7b3559ac8131c14a4eca73a781d22178"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_txt</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">instance_name</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">service_type</span></span>, <span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">proto</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <a class="reference internal" href="#_CPPv413mdns_result_t" title="mdns_result_t"><span class="n"><span class="pre">mdns_result_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">result</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv414mdns_query_txtPKcPKcPKc8uint32_tPP13mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for TXT record. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>instance_name</strong> – service instance name </p></li>
<li><p><strong>service_type</strong> – service type (_http, _arduino, _ftp etc.) </p></li>
<li><p><strong>proto</strong> – service protocol (_tcp, _udp, etc.) </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answer. </p></li>
<li><p><strong>result</strong> – pointer to the result of the query</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG parameter error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv412mdns_query_aPKc8uint32_tP14esp_ip4_addr_t">
<span id="_CPPv312mdns_query_aPKc8uint32_tP14esp_ip4_addr_t"></span><span id="_CPPv212mdns_query_aPKc8uint32_tP14esp_ip4_addr_t"></span><span id="mdns_query_a__cCP.uint32_t.esp_ip4_addr_tP"></span><span class="target" id="mdns_8h_1a1c7ccc14c3a0a6cf29af3fe33345ad78"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_a</span></span></span><span class="sig-paren">(</span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">host_name</span></span>, <span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="n sig-param"><span class="pre">timeout</span></span>, <span class="n"><span class="pre">esp_ip4_addr_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">addr</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv412mdns_query_aPKc8uint32_tP14esp_ip4_addr_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Query mDNS for A record. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>host_name</strong> – host name to look for </p></li>
<li><p><strong>timeout</strong> – time in milliseconds to wait for answer. </p></li>
<li><p><strong>addr</strong> – pointer to the resulting IP4 address</p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NO_MEM memory error</p></li>
<li><p>ESP_ERR_INVALID_ARG parameter error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv419mdns_register_netifP11esp_netif_t">
<span id="_CPPv319mdns_register_netifP11esp_netif_t"></span><span id="_CPPv219mdns_register_netifP11esp_netif_t"></span><span id="mdns_register_netif__esp_netif_tP"></span><span class="target" id="mdns_8h_1ae4512122be1ad7c7f87536b944c43b78"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_register_netif</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">esp_netif_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">esp_netif</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv419mdns_register_netifP11esp_netif_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Register custom esp_netif with mDNS functionality mDNS service runs by default on preconfigured interfaces (STA, AP, ETH). This API enables running the service on any customized interface, either using standard WiFi or Ethernet driver or any kind of user defined driver. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>esp_netif</strong> – Pointer to esp-netif interface </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running or this netif is already registered</p></li>
<li><p>ESP_ERR_NO_MEM not enough memory for this in interface in the netif list (see CONFIG_MDNS_MAX_INTERFACES) </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv421mdns_unregister_netifP11esp_netif_t">
<span id="_CPPv321mdns_unregister_netifP11esp_netif_t"></span><span id="_CPPv221mdns_unregister_netifP11esp_netif_t"></span><span id="mdns_unregister_netif__esp_netif_tP"></span><span class="target" id="mdns_8h_1af9bda443a1b8b50ed5ebbc6f5f58e62f"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_unregister_netif</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">esp_netif_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">esp_netif</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv421mdns_unregister_netifP11esp_netif_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Unregister esp-netif already registered in mDNS service. </p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><p><strong>esp_netif</strong> – Pointer to esp-netif interface </p>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running</p></li>
<li><p>ESP_ERR_NOT_FOUND this esp-netif was not registered in mDNS service </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

<dl class="cpp function">
<dt class="sig sig-object cpp" id="_CPPv417mdns_netif_actionP11esp_netif_t20mdns_event_actions_t">
<span id="_CPPv317mdns_netif_actionP11esp_netif_t20mdns_event_actions_t"></span><span id="_CPPv217mdns_netif_actionP11esp_netif_t20mdns_event_actions_t"></span><span id="mdns_netif_action__esp_netif_tP.mdns_event_actions_t"></span><span class="target" id="mdns_8h_1a73730bf2cd7988ce75bb3397d3203cfa"></span><span class="n"><span class="pre">esp_err_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_netif_action</span></span></span><span class="sig-paren">(</span><span class="n"><span class="pre">esp_netif_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n sig-param"><span class="pre">esp_netif</span></span>, <a class="reference internal" href="#_CPPv420mdns_event_actions_t" title="mdns_event_actions_t"><span class="n"><span class="pre">mdns_event_actions_t</span></span></a><span class="w"> </span><span class="n sig-param"><span class="pre">event_action</span></span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv417mdns_netif_actionP11esp_netif_t20mdns_event_actions_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Set esp_netif to a desired state, or perform a desired action, such as enable/disable this interface or send announcement packets to this netif. </p>
<p><ul class="simple">
<li><p>This function is used to enable (probe, resolve conflicts and announce), announce, or disable (send bye) mDNS services on the specified network interface.</p></li>
<li><p>This function must be called if users registers a specific interface using mdns_register_netif() to enable mDNS services on that interface.</p></li>
<li><p>This function could be used in IP/connection event handlers to automatically enable/announce mDNS services when network properties change and/or disable them on disconnection.</p></li>
</ul>
</p>
<dl class="field-list simple">
<dt class="field-odd">参数</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>esp_netif</strong> – Pointer to esp-netif interface </p></li>
<li><p><strong>event_action</strong> – Disable/Enable/Announce on this interface over IPv4/IPv6 protocol. Actions enumerated in mdns_event_actions_t type. </p></li>
</ul>
</dd>
<dt class="field-even">返回</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>ESP_OK success</p></li>
<li><p>ESP_ERR_INVALID_STATE mDNS is not running or this netif is not registered</p></li>
<li><p>ESP_ERR_NO_MEM memory error </p></li>
</ul>
</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="structures">
<h3>Structures<a class="headerlink" href="#structures" title="永久链接至标题"></a></h3>
<dl class="cpp struct">
<dt class="sig sig-object cpp" id="_CPPv415mdns_txt_item_t">
<span id="_CPPv315mdns_txt_item_t"></span><span id="_CPPv215mdns_txt_item_t"></span><span id="mdns_txt_item_t"></span><span class="target" id="structmdns__txt__item__t"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_txt_item_t</span></span></span><a class="headerlink" href="#_CPPv415mdns_txt_item_t" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS basic text item structure Used in mdns_service_add() </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N15mdns_txt_item_t3keyE">
<span id="_CPPv3N15mdns_txt_item_t3keyE"></span><span id="_CPPv2N15mdns_txt_item_t3keyE"></span><span id="mdns_txt_item_t::key__cCP"></span><span class="target" id="structmdns__txt__item__t_1aac2205bf54deede319e61f03560677ee"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">key</span></span></span><a class="headerlink" href="#_CPPv4N15mdns_txt_item_t3keyE" title="永久链接至目标"></a><br /></dt>
<dd><p>item key name </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N15mdns_txt_item_t5valueE">
<span id="_CPPv3N15mdns_txt_item_t5valueE"></span><span id="_CPPv2N15mdns_txt_item_t5valueE"></span><span id="mdns_txt_item_t::value__cCP"></span><span class="target" id="structmdns__txt__item__t_1afd248c401d6c0c00ba0a77eb6bd89fd7"></span><span class="k"><span class="pre">const</span></span><span class="w"> </span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">value</span></span></span><a class="headerlink" href="#_CPPv4N15mdns_txt_item_t5valueE" title="永久链接至目标"></a><br /></dt>
<dd><p>item value string </p>
</dd></dl>

</div>
</dd></dl>

<dl class="cpp struct">
<dt class="sig sig-object cpp" id="_CPPv414mdns_ip_addr_s">
<span id="_CPPv314mdns_ip_addr_s"></span><span id="_CPPv214mdns_ip_addr_s"></span><span id="mdns_ip_addr_s"></span><span class="target" id="structmdns__ip__addr__s"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_ip_addr_s</span></span></span><a class="headerlink" href="#_CPPv414mdns_ip_addr_s" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS query linked list IP item </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N14mdns_ip_addr_s4addrE">
<span id="_CPPv3N14mdns_ip_addr_s4addrE"></span><span id="_CPPv2N14mdns_ip_addr_s4addrE"></span><span id="mdns_ip_addr_s::addr__esp_ip_addr_t"></span><span class="target" id="structmdns__ip__addr__s_1a6551a9e844533214d7da7f26921e8d7b"></span><span class="n"><span class="pre">esp_ip_addr_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">addr</span></span></span><a class="headerlink" href="#_CPPv4N14mdns_ip_addr_s4addrE" title="永久链接至目标"></a><br /></dt>
<dd><p>IP address </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N14mdns_ip_addr_s4nextE">
<span id="_CPPv3N14mdns_ip_addr_s4nextE"></span><span id="_CPPv2N14mdns_ip_addr_s4nextE"></span><span id="mdns_ip_addr_s::next__mdns_ip_addr_sP"></span><span class="target" id="structmdns__ip__addr__s_1acd517df206b0c3e16450f3fc0ada3185"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv414mdns_ip_addr_s" title="mdns_ip_addr_s"><span class="n"><span class="pre">mdns_ip_addr_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">next</span></span></span><a class="headerlink" href="#_CPPv4N14mdns_ip_addr_s4nextE" title="永久链接至目标"></a><br /></dt>
<dd><p>next IP, or NULL for the last IP in the list </p>
</dd></dl>

</div>
</dd></dl>

<dl class="cpp struct">
<dt class="sig sig-object cpp" id="_CPPv413mdns_result_s">
<span id="_CPPv313mdns_result_s"></span><span id="_CPPv213mdns_result_s"></span><span id="mdns_result_s"></span><span class="target" id="structmdns__result__s"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_result_s</span></span></span><a class="headerlink" href="#_CPPv413mdns_result_s" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS query result structure </p>
<div class="breathe-sectiondef docutils container">
<p class="breathe-sectiondef-title rubric" id="breathe-section-title-public-members">Public Members</p>
<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s4nextE">
<span id="_CPPv3N13mdns_result_s4nextE"></span><span id="_CPPv2N13mdns_result_s4nextE"></span><span id="mdns_result_s::next__mdns_result_sP"></span><span class="target" id="structmdns__result__s_1afd40f35c5cd387069c66f9bb7e4f622d"></span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv413mdns_result_s" title="mdns_result_s"><span class="n"><span class="pre">mdns_result_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">next</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s4nextE" title="永久链接至目标"></a><br /></dt>
<dd><p>next result, or NULL for the last result in the list </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s9esp_netifE">
<span id="_CPPv3N13mdns_result_s9esp_netifE"></span><span id="_CPPv2N13mdns_result_s9esp_netifE"></span><span id="mdns_result_s::esp_netif__esp_netif_tP"></span><span class="target" id="structmdns__result__s_1a44927f82f91a1e730f20c342ed12e4f9"></span><span class="n"><span class="pre">esp_netif_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">esp_netif</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s9esp_netifE" title="永久链接至目标"></a><br /></dt>
<dd><p>ptr to corresponding esp-netif </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s3ttlE">
<span id="_CPPv3N13mdns_result_s3ttlE"></span><span id="_CPPv2N13mdns_result_s3ttlE"></span><span id="mdns_result_s::ttl__uint32_t"></span><span class="target" id="structmdns__result__s_1ad9737835c45c2f11be1ee17a483fefff"></span><span class="n"><span class="pre">uint32_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">ttl</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s3ttlE" title="永久链接至目标"></a><br /></dt>
<dd><p>time to live </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s11ip_protocolE">
<span id="_CPPv3N13mdns_result_s11ip_protocolE"></span><span id="_CPPv2N13mdns_result_s11ip_protocolE"></span><span id="mdns_result_s::ip_protocol__mdns_ip_protocol_t"></span><span class="target" id="structmdns__result__s_1aff66b72bd7941a197d96d86a473f79e4"></span><a class="reference internal" href="#_CPPv418mdns_ip_protocol_t" title="mdns_ip_protocol_t"><span class="n"><span class="pre">mdns_ip_protocol_t</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">ip_protocol</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s11ip_protocolE" title="永久链接至目标"></a><br /></dt>
<dd><p>ip_protocol type of the interface (v4/v6) </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s13instance_nameE">
<span id="_CPPv3N13mdns_result_s13instance_nameE"></span><span id="_CPPv2N13mdns_result_s13instance_nameE"></span><span id="mdns_result_s::instance_name__cP"></span><span class="target" id="structmdns__result__s_1ac67b4af869b06a6245e764675120ad7b"></span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">instance_name</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s13instance_nameE" title="永久链接至目标"></a><br /></dt>
<dd><p>instance name </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s12service_typeE">
<span id="_CPPv3N13mdns_result_s12service_typeE"></span><span id="_CPPv2N13mdns_result_s12service_typeE"></span><span id="mdns_result_s::service_type__cP"></span><span class="target" id="structmdns__result__s_1a23e829b4dfcd4c983fe20f8c88139be2"></span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">service_type</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s12service_typeE" title="永久链接至目标"></a><br /></dt>
<dd><p>service type </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s5protoE">
<span id="_CPPv3N13mdns_result_s5protoE"></span><span id="_CPPv2N13mdns_result_s5protoE"></span><span id="mdns_result_s::proto__cP"></span><span class="target" id="structmdns__result__s_1ae18827fe3e06b3ece9d4bf54606200d1"></span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">proto</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s5protoE" title="永久链接至目标"></a><br /></dt>
<dd><p>srevice protocol </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s8hostnameE">
<span id="_CPPv3N13mdns_result_s8hostnameE"></span><span id="_CPPv2N13mdns_result_s8hostnameE"></span><span id="mdns_result_s::hostname__cP"></span><span class="target" id="structmdns__result__s_1aa4d541285021faf8feb2e0f5abe89353"></span><span class="kt"><span class="pre">char</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">hostname</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s8hostnameE" title="永久链接至目标"></a><br /></dt>
<dd><p>hostname </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s4portE">
<span id="_CPPv3N13mdns_result_s4portE"></span><span id="_CPPv2N13mdns_result_s4portE"></span><span id="mdns_result_s::port__uint16_t"></span><span class="target" id="structmdns__result__s_1a968bcd2e2ddec6c1ceba674dfa59e5bd"></span><span class="n"><span class="pre">uint16_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">port</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s4portE" title="永久链接至目标"></a><br /></dt>
<dd><p>service port </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s3txtE">
<span id="_CPPv3N13mdns_result_s3txtE"></span><span id="_CPPv2N13mdns_result_s3txtE"></span><span id="mdns_result_s::txt__mdns_txt_item_tP"></span><span class="target" id="structmdns__result__s_1a895ba931c167a9159b331562781a83d2"></span><a class="reference internal" href="#_CPPv415mdns_txt_item_t" title="mdns_txt_item_t"><span class="n"><span class="pre">mdns_txt_item_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">txt</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s3txtE" title="永久链接至目标"></a><br /></dt>
<dd><p>txt record </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s13txt_value_lenE">
<span id="_CPPv3N13mdns_result_s13txt_value_lenE"></span><span id="_CPPv2N13mdns_result_s13txt_value_lenE"></span><span id="mdns_result_s::txt_value_len__uint8_tP"></span><span class="target" id="structmdns__result__s_1a4116fbfc03331cb0de5c1ac75efb81ad"></span><span class="n"><span class="pre">uint8_t</span></span><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">txt_value_len</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s13txt_value_lenE" title="永久链接至目标"></a><br /></dt>
<dd><p>array of txt value len of each record </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s9txt_countE">
<span id="_CPPv3N13mdns_result_s9txt_countE"></span><span id="_CPPv2N13mdns_result_s9txt_countE"></span><span id="mdns_result_s::txt_count__s"></span><span class="target" id="structmdns__result__s_1af160c366650f60688c93dc0473af6385"></span><span class="n"><span class="pre">size_t</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">txt_count</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s9txt_countE" title="永久链接至目标"></a><br /></dt>
<dd><p>number of txt items </p>
</dd></dl>

<dl class="cpp var">
<dt class="sig sig-object cpp" id="_CPPv4N13mdns_result_s4addrE">
<span id="_CPPv3N13mdns_result_s4addrE"></span><span id="_CPPv2N13mdns_result_s4addrE"></span><span id="mdns_result_s::addr__mdns_ip_addr_tP"></span><span class="target" id="structmdns__result__s_1ad1874ef7491e8a973182a8253b742514"></span><a class="reference internal" href="#_CPPv414mdns_ip_addr_t" title="mdns_ip_addr_t"><span class="n"><span class="pre">mdns_ip_addr_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">addr</span></span></span><a class="headerlink" href="#_CPPv4N13mdns_result_s4addrE" title="永久链接至目标"></a><br /></dt>
<dd><p>linked list of IP addresses found </p>
</dd></dl>

</div>
</dd></dl>

</section>
<section id="macros">
<h3>Macros<a class="headerlink" href="#macros" title="永久链接至标题"></a></h3>
<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_A">
<span class="target" id="mdns_8h_1aadb9a175b672893b350f1e7032009e00"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_A</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_A" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_PTR">
<span class="target" id="mdns_8h_1ab20e7e819cd80446f00124e510e76e7d"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_PTR</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_PTR" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_TXT">
<span class="target" id="mdns_8h_1a177dfb02a742aae54654f74060afd078"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_TXT</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_TXT" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_AAAA">
<span class="target" id="mdns_8h_1a70afb421967cdc04c57d4aef6ac01c71"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_AAAA</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_AAAA" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_SRV">
<span class="target" id="mdns_8h_1aa0284acaadb1f19e3eefb0c851c46295"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_SRV</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_SRV" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_OPT">
<span class="target" id="mdns_8h_1a0f303a6564a2a3e96f1d641467b587fc"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_OPT</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_OPT" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_NSEC">
<span class="target" id="mdns_8h_1a6a701bfe1d93ccd23f7eefed93ac5d3d"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_NSEC</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_NSEC" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp macro">
<dt class="sig sig-object cpp" id="c.MDNS_TYPE_ANY">
<span class="target" id="mdns_8h_1a07b84349539bc1343c8a0fd0456869c2"></span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_TYPE_ANY</span></span></span><a class="headerlink" href="#c.MDNS_TYPE_ANY" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

</section>
<section id="type-definitions">
<h3>Type Definitions<a class="headerlink" href="#type-definitions" title="永久链接至标题"></a></h3>
<dl class="cpp type">
<dt class="sig sig-object cpp" id="_CPPv418mdns_search_once_t">
<span id="_CPPv318mdns_search_once_t"></span><span id="_CPPv218mdns_search_once_t"></span><span id="mdns_search_once_t"></span><span class="target" id="mdns_8h_1a8815240672c5880e798ca6655309c589"></span><span class="k"><span class="pre">typedef</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="n"><span class="pre">mdns_search_once_s</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_search_once_t</span></span></span><a class="headerlink" href="#_CPPv418mdns_search_once_t" title="永久链接至目标"></a><br /></dt>
<dd><p>Asynchronous query handle. </p>
</dd></dl>

<dl class="cpp type">
<dt class="sig sig-object cpp" id="_CPPv414mdns_ip_addr_t">
<span id="_CPPv314mdns_ip_addr_t"></span><span id="_CPPv214mdns_ip_addr_t"></span><span id="mdns_ip_addr_t"></span><span class="target" id="mdns_8h_1ad47a3252d28bfa29bad2c27475042670"></span><span class="k"><span class="pre">typedef</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv414mdns_ip_addr_s" title="mdns_ip_addr_s"><span class="n"><span class="pre">mdns_ip_addr_s</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_ip_addr_t</span></span></span><a class="headerlink" href="#_CPPv414mdns_ip_addr_t" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS query linked list IP item </p>
</dd></dl>

<dl class="cpp type">
<dt class="sig sig-object cpp" id="_CPPv413mdns_result_t">
<span id="_CPPv313mdns_result_t"></span><span id="_CPPv213mdns_result_t"></span><span id="mdns_result_t"></span><span class="target" id="mdns_8h_1a117010e231eeb226e391046f9eb7d2b5"></span><span class="k"><span class="pre">typedef</span></span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#_CPPv413mdns_result_s" title="mdns_result_s"><span class="n"><span class="pre">mdns_result_s</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_result_t</span></span></span><a class="headerlink" href="#_CPPv413mdns_result_t" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS query result structure </p>
</dd></dl>

<dl class="cpp type">
<dt class="sig sig-object cpp" id="_CPPv419mdns_query_notify_t">
<span id="_CPPv319mdns_query_notify_t"></span><span id="_CPPv219mdns_query_notify_t"></span><span id="mdns_query_notify_t"></span><span class="target" id="mdns_8h_1a94c9a720637875a50eef6e0436d9116d"></span><span class="k"><span class="pre">typedef</span></span><span class="w"> </span><span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">(</span></span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_notify_t</span></span></span><span class="p"><span class="pre">)</span></span><span class="p"><span class="pre">(</span></span><a class="reference internal" href="#_CPPv418mdns_search_once_t" title="mdns_search_once_t"><span class="n"><span class="pre">mdns_search_once_t</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">search</span></span><span class="p"><span class="pre">)</span></span><a class="headerlink" href="#_CPPv419mdns_query_notify_t" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

</section>
<section id="enumerations">
<h3>Enumerations<a class="headerlink" href="#enumerations" title="永久链接至标题"></a></h3>
<dl class="cpp enum">
<dt class="sig sig-object cpp" id="_CPPv420mdns_event_actions_t">
<span id="_CPPv320mdns_event_actions_t"></span><span id="_CPPv220mdns_event_actions_t"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdf"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_event_actions_t</span></span></span><a class="headerlink" href="#_CPPv420mdns_event_actions_t" title="永久链接至目标"></a><br /></dt>
<dd><p><em>Values:</em></p>
<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP4E">
<span id="_CPPv3N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP4E"></span><span id="_CPPv2N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP4E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa691b25d61998415df802aa6f2679c197"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_ENABLE_IP4</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP4E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP6E">
<span id="_CPPv3N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP6E"></span><span id="_CPPv2N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP6E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa614ec41ac76531e944afd90a5c3da558"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_ENABLE_IP6</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t21MDNS_EVENT_ENABLE_IP6E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP4E">
<span id="_CPPv3N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP4E"></span><span id="_CPPv2N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP4E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfaec15d76ae495cba9a1cc3ae2c2303515"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_ANNOUNCE_IP4</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP4E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP6E">
<span id="_CPPv3N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP6E"></span><span id="_CPPv2N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP6E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa5082be5361ecaafa83b07fd41bd6a6e5"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_ANNOUNCE_IP6</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t23MDNS_EVENT_ANNOUNCE_IP6E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP4E">
<span id="_CPPv3N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP4E"></span><span id="_CPPv2N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP4E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa329801c5f1d481ec46a40bbea0836dd6"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_DISABLE_IP4</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP4E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP6E">
<span id="_CPPv3N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP6E"></span><span id="_CPPv2N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP6E"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa5406bf4e980611d0fe5b8d27fc79554a"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_DISABLE_IP6</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t22MDNS_EVENT_DISABLE_IP6E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t29MDNS_EVENT_IP4_REVERSE_LOOKUPE">
<span id="_CPPv3N20mdns_event_actions_t29MDNS_EVENT_IP4_REVERSE_LOOKUPE"></span><span id="_CPPv2N20mdns_event_actions_t29MDNS_EVENT_IP4_REVERSE_LOOKUPE"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfacdd7f535f9cd3873a07715b39d967842"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_IP4_REVERSE_LOOKUP</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t29MDNS_EVENT_IP4_REVERSE_LOOKUPE" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N20mdns_event_actions_t29MDNS_EVENT_IP6_REVERSE_LOOKUPE">
<span id="_CPPv3N20mdns_event_actions_t29MDNS_EVENT_IP6_REVERSE_LOOKUPE"></span><span id="_CPPv2N20mdns_event_actions_t29MDNS_EVENT_IP6_REVERSE_LOOKUPE"></span><span class="target" id="mdns_8h_1a14279e8f2e7c65c12320222a55f09fdfa09accfff1b78150b88fcab24f2413e76"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_EVENT_IP6_REVERSE_LOOKUP</span></span></span><a class="headerlink" href="#_CPPv4N20mdns_event_actions_t29MDNS_EVENT_IP6_REVERSE_LOOKUPE" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

</dd></dl>

<dl class="cpp enum">
<dt class="sig sig-object cpp" id="_CPPv418mdns_ip_protocol_t">
<span id="_CPPv318mdns_ip_protocol_t"></span><span id="_CPPv218mdns_ip_protocol_t"></span><span class="target" id="mdns_8h_1a13f9e348f77ff335c56cc23978ce6598"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_ip_protocol_t</span></span></span><a class="headerlink" href="#_CPPv418mdns_ip_protocol_t" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS enum to specify the ip_protocol type </p>
<p><em>Values:</em></p>
<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V4E">
<span id="_CPPv3N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V4E"></span><span id="_CPPv2N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V4E"></span><span class="target" id="mdns_8h_1a13f9e348f77ff335c56cc23978ce6598a050dbfb44023f3573f27af9a95432d18"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_IP_PROTOCOL_V4</span></span></span><a class="headerlink" href="#_CPPv4N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V4E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V6E">
<span id="_CPPv3N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V6E"></span><span id="_CPPv2N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V6E"></span><span class="target" id="mdns_8h_1a13f9e348f77ff335c56cc23978ce6598a04e4300ba58e47beb8d587ab26eab884"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_IP_PROTOCOL_V6</span></span></span><a class="headerlink" href="#_CPPv4N18mdns_ip_protocol_t19MDNS_IP_PROTOCOL_V6E" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N18mdns_ip_protocol_t20MDNS_IP_PROTOCOL_MAXE">
<span id="_CPPv3N18mdns_ip_protocol_t20MDNS_IP_PROTOCOL_MAXE"></span><span id="_CPPv2N18mdns_ip_protocol_t20MDNS_IP_PROTOCOL_MAXE"></span><span class="target" id="mdns_8h_1a13f9e348f77ff335c56cc23978ce6598a294747186fedd262f98ed90cb0202117"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_IP_PROTOCOL_MAX</span></span></span><a class="headerlink" href="#_CPPv4N18mdns_ip_protocol_t20MDNS_IP_PROTOCOL_MAXE" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

</dd></dl>

<dl class="cpp enum">
<dt class="sig sig-object cpp" id="_CPPv430mdns_query_transmission_type_t">
<span id="_CPPv330mdns_query_transmission_type_t"></span><span id="_CPPv230mdns_query_transmission_type_t"></span><span class="target" id="mdns_8h_1ac98ee14100356cdc89391b419d160475"></span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">mdns_query_transmission_type_t</span></span></span><a class="headerlink" href="#_CPPv430mdns_query_transmission_type_t" title="永久链接至目标"></a><br /></dt>
<dd><p>mDNS query type to be explicitly set to either Unicast or Multicast </p>
<p><em>Values:</em></p>
<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N30mdns_query_transmission_type_t18MDNS_QUERY_UNICASTE">
<span id="_CPPv3N30mdns_query_transmission_type_t18MDNS_QUERY_UNICASTE"></span><span id="_CPPv2N30mdns_query_transmission_type_t18MDNS_QUERY_UNICASTE"></span><span class="target" id="mdns_8h_1ac98ee14100356cdc89391b419d160475a575a7f2670fc0e2ff6b06d5f884ce770"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_QUERY_UNICAST</span></span></span><a class="headerlink" href="#_CPPv4N30mdns_query_transmission_type_t18MDNS_QUERY_UNICASTE" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

<dl class="cpp enumerator">
<dt class="sig sig-object cpp" id="_CPPv4N30mdns_query_transmission_type_t20MDNS_QUERY_MULTICASTE">
<span id="_CPPv3N30mdns_query_transmission_type_t20MDNS_QUERY_MULTICASTE"></span><span id="_CPPv2N30mdns_query_transmission_type_t20MDNS_QUERY_MULTICASTE"></span><span class="target" id="mdns_8h_1ac98ee14100356cdc89391b419d160475aa5477342100c5070ee39d4f264e31e29"></span><span class="k"><span class="pre">enumerator</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">MDNS_QUERY_MULTICAST</span></span></span><a class="headerlink" href="#_CPPv4N30mdns_query_transmission_type_t20MDNS_QUERY_MULTICASTE" title="永久链接至目标"></a><br /></dt>
<dd></dd></dl>

</dd></dl>

</section>
</section>
</section>


           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; 版权所有 2016 - 2023 乐鑫信息科技（上海）股份有限公司.</p>
  </div>

  <ul class="footer">
        <li>
	    
            
            利用 <a href="http://sphinx-doc.org/">Sphinx</a> 构建，使用了  <a href="https://github.com/espressif/sphinx_idf_theme">主题</a>  based on <a href="https://github.com/readthedocs/sphinx_rtd_theme">Read the Docs Sphinx Theme</a>.
         </li>
    <li class="footer-aside">
        <a href="./esp-idf-zh_CN-master-esp32.pdf" class="fa fa-file-pdf-o"> Download PDF</a>
    </li>

  </ul> 

</footer>
        </div>
      </div>
    </section>
  </div>

  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html><script type=text/javascript>
window.onload =(function() {
    var myAnchor = document.getElementById('version-select');
    var mySpan = document.createElement('input');
    mySpan.setAttribute('type', 'text');
    mySpan.setAttribute('maxLength', '10');
    mySpan.value = 'latest';
    mySpan.setAttribute('disabled', true);
    myAnchor.parentNode.replaceChild(mySpan, myAnchor);

    var myAnchor = document.getElementById('target-select');
    var mySpan = document.createElement('input');
    mySpan.setAttribute('type', 'text');
    mySpan.setAttribute('maxLength', '10');
    mySpan.value = 'all targets';
    mySpan.setAttribute('disabled', true);
    myAnchor.parentNode.replaceChild(mySpan, myAnchor);

})();
</script>
